<template>
  <div class="box">
    <h2>我的echarts项目</h2>
    <div class="main">
      <Abc :stu="stuData"></Abc>
      <Pie :stu="stuData"></Pie>
    </div>
  </div>
</template>

<script>
// 导入组件
import Pie from '@/components/Pie.vue'
import Abc from '@/components/Abc.vue'

export default {
  data() {
    return {
      stuData: []
    }
  },
  created() {
    // console.log(this.lt.name)
    // console.log(this.lt.age)
    this.axios.get('http://www.itcbc.com:3006/api/stulist').then(result => {
      console.log(result.data)
      if (result.data.code === 0) {
        this.stuData = result.data.data // 把服务器返回的数据赋值给 data 中的变量
      }
    })
  },

  // 注册组件
  components: {
    Abc,
    Pie
  }
}
</script>

<style lang="less">
.main {
  display: flex;

  > div {
    flex: 1;
    min-height: 300px;
    margin: 20px;
  }
}
</style>
